/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.sistema.db;


import java.awt.Color;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

/**
 *
 * @author gr
 */
public class MsgErro extends JDialog
{

    private ImageIcon imgErro;
    private JTextArea taMsgErro;
    private String msg;
    private String causa;



    public MsgErro(String msg, Exception causa)
    {
        setTitle( "Erro no Sistema");
        setSize( 800, 350 );
        setLocationRelativeTo( null );
        java.awt.Toolkit.getDefaultToolkit().beep();
        setVisible( true );

        this.msg = msg;
        this.causa = causa.toString();

        iniciaComponentes();
    }

    public void iniciaComponentes()
    {
        setLayout( null );

        imgErro = new ImageIcon( getClass().getResource( "/img/img_errobanco.png" ));
        add(new JLabel(imgErro)).setBounds( 10, 10, 150, 200);

        taMsgErro = new JTextArea(10,15);
        taMsgErro.setEditable( false );
        taMsgErro.setDisabledTextColor( Color.BLACK );
        taMsgErro.setText( msg + "\n \n" +causa );
        add(new JScrollPane(taMsgErro)).setBounds( 200, 40, 550, 250);


    }

}
